#include <regex>
#include <string>
#include <iostream>
int main()
{
    std::string url = "GET /example/path/to/resource? HTTP/1.0";
    std::regex pattern ("(GET|POST|DELETE|PUT|HEAD) ([^?]*)(?:\\?(.*))? (HTTP/1\\.[10])(?:\n|\r\n)?", std::regex::icase);
    // std::string url = "ab";
    // std::regex pattern("(?:a(b))");
    std::smatch match;
    if (std::regex_match(url, match, pattern)) {
        std::cout << "匹配成功: " << match[0] << std::endl;
    } else {
        std::cout << "没有匹配到" << std::endl;
    }
    for(const auto& m : match) {
        std::cout << "匹配到: " << m << std::endl;
    }
    return 0;
}